#include<stdio.h>
#include<unistd.h>
main ()
{
    int rid;
    rid= fork();
    if (rid< 0) { printf("fork error! "); return; }
    if (rid> 0 )// 父进程分支
        printf("I am parent, my rid is \%d, my PID is \%d", rid, getpid ());
    else//子进程分支
        printf("I am child, my rid is \%d, my PID is \%d", rid, getpid ());
}